// ActionScript file
import com.adobe.cairngorm.control.CairngormEventDispatcher;

import flash.events.Event;

import mx.events.ListEvent;
import mx.messaging.AbstractConsumer;

import net.optix.ip.events.GetActionsEvent;
import net.optix.ip.model.ModelLocator;
import net.optix.ip.vo.InventionVO;

import views.ViewInstance;

[Bindable]
private var model:ModelLocator	=	ModelLocator.getInstance();

[Bindable]
private var bShow:Boolean	=	false;

private var welcome:String	=	
	'IP Manager helps growing businesses manage their intellectual property.\n\n'+
	'The site allows your inventors to store a disclosure of each of their inventions.\n\n'+
	'In addition, IP manager can help you determine a potential value for an invention.\n\n'+
	'A manager for your business can track the inventions,and if desired, request bids from multiple law firms for preparation and filing of a patent application.\n\n'
	+'A manager for your business can track the inventions,and if desired, request bids from multiple law firms for preparation and filing of a patent application.IP Manager does not provide legal services,but can connect your business with cost-effective legal representation.\n';
private function initApp():void
{	
	
}

private function viewInvention(event:Event):void
{
	
}

private function selectInvention(event:Event):void
{
	var index:int	=	DataGrid(event.target).selectedIndex;
	if(index >= 0)
	{
		model.currentInvention	=	InventionVO(DataGrid(event.target).selectedItem);
	}

	if(event.type == ListEvent.ITEM_DOUBLE_CLICK)
	{
		model.view	=	0;
		model.view	=	ViewInstance.ViewInvention;
		model.oldView=	ViewInstance.ViewInventions;
		model.inventionView	=	0;
		var getActions:GetActionsEvent	=	new GetActionsEvent(model.currentInvention.inventionID);
		com.adobe.cairngorm.control.CairngormEventDispatcher.getInstance().dispatchEvent(getActions);
	}
}

private function searchInventions(words:String):void
{
	var url:URLRequest	=	new URLRequest();
	url.url				=	model.url+"Invention/SearchInventions/KeyWords/"+words;
	navigateToURL(url,"_blank");
}

public function test():void
{
	trace(this);
}